#!/usr/bin/python
# -*- coding: UTF-8 -*-
from datetime import datetime
from music.DataFilter import FilterData
import matplotlib.pyplot as plot
import pandas as pd
import numpy as np
from utils.GwordClude import generate_cloud_word
import jieba
import re
import pymongo
from hakul.hakul_config import *
#指定默认字体
plot.rcParams['font.sans-serif'] = ['SimHei']
plot.rcParams['font.family']='sans-serif'
# https://blog.csdn.net/zenghaihong/article/details/70747247 时间

client=pymongo.MongoClient(HAKUL_URL,port=27017)
db=client[HAKUL_DB]
result=db.authenticate("haku_mongo_user", "Haku12345678")
print(result)


def get_data():
    queryArgs = {}
    projectionFields = {"_class":False}  # 用字典指定
    result = db["hakudata"].find(queryArgs,projectionFields)
    return result


def main():
    data=pd.read_csv("demo.csv",encoding="utf-8",index_col="Unnamed: 0")
    print(data.head(10))



def get_data_mongo():
    data = pd.DataFrame(list(get_data()))
    data.to_csv("demo.csv", encoding="utf-8")
    data = data.head(10)
    print(data.head())


if __name__ == '__main__':
    main()